package cn.lyvust.demo.shili09.join01;

public class Join01Test {
    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            if (i == 5) {
                System.out.println("====>i等于5,子线程开始执行了");
                WorkThread thread = new WorkThread();
                thread.start();
                try {
                    //join：执行本线程，阻塞主线程
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("====>子线程执行完成了");
            }
            System.out.println(Thread.currentThread().getName()+""+i);
        }
    }
}
